/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "tipo_documento", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoDocumento.findAll", query = "SELECT t FROM TipoDocumento t"),
    @NamedQuery(name = "TipoDocumento.findByTipoCod", query = "SELECT t FROM TipoDocumento t WHERE t.tipoCod = :tipoCod"),
    @NamedQuery(name = "TipoDocumento.findByTipoDescip", query = "SELECT t FROM TipoDocumento t WHERE t.tipoDescip = :tipoDescip")})
public class TipoDocumento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "tipo_cod", nullable = false)
    private Integer tipoCod;
    @Size(max = 30)
    @Column(name = "tipo_descip", length = 30)
    private String tipoDescip;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoDocumentoTipoCod")
    private Collection<OrdenPago> ordenPagoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoDocumentoTipoCod")
    private Collection<RendicionFijo> rendicionFijoCollection;

    public TipoDocumento() {
    }

    public TipoDocumento(Integer tipoCod) {
        this.tipoCod = tipoCod;
    }

    public Integer getTipoCod() {
        return tipoCod;
    }

    public void setTipoCod(Integer tipoCod) {
        this.tipoCod = tipoCod;
    }

    public String getTipoDescip() {
        return tipoDescip;
    }

    public void setTipoDescip(String tipoDescip) {
        this.tipoDescip = tipoDescip;
    }

    @XmlTransient
    public Collection<OrdenPago> getOrdenPagoCollection() {
        return ordenPagoCollection;
    }

    public void setOrdenPagoCollection(Collection<OrdenPago> ordenPagoCollection) {
        this.ordenPagoCollection = ordenPagoCollection;
    }

    @XmlTransient
    public Collection<RendicionFijo> getRendicionFijoCollection() {
        return rendicionFijoCollection;
    }

    public void setRendicionFijoCollection(Collection<RendicionFijo> rendicionFijoCollection) {
        this.rendicionFijoCollection = rendicionFijoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tipoCod != null ? tipoCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoDocumento)) {
            return false;
        }
        TipoDocumento other = (TipoDocumento) object;
        if ((this.tipoCod == null && other.tipoCod != null) || (this.tipoCod != null && !this.tipoCod.equals(other.tipoCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.TipoDocumento[ tipoCod=" + tipoCod + " ]";
    }
    
}
